<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="<%=path %>/layui/css/layui.css">
  <link rel="stylesheet" href="<%=path %>/layui/css/lxq.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="<%=path %>/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=path %>/layui/util.js" charset="utf-8"></script>
</head>
<body>
<div class="lxq-body">
	<div class="layui-row lxq-address">
		位置：信息管理>学院信息
		<hr>
	</div>


	
	<div class="layui-row lxq-search" >

		<div class="data-search">
		  搜索ID：
		  <div class="layui-inline">
		    <input class="layui-input" name="id" id="search_id" autocomplete="off">
		  </div>
		  <button class="layui-btn" data-type="reload">搜索</button>
		</div>
	
	</div>
  <div class="layui-row">
      <table class="layui-hide" id="data_form" lay-filter="main"></table> 
	</div>

 		

</div>              
          

 
<script>
layui.use(['table'], function(){
  var table = layui.table;
  
  table.render({
	    elem: '#data_form'
	    ,url:'<%=path %>/biz/Info_list'
   	    ,where: {
   		  level: 1
   	    }
	    ,toolbar: '#toolbarDemo'
	    ,page: true
	    ,cols: [[
	       {type:'numbers', title:'序号'}
	      ,{field:'infoId',  title: '编号'}
	      ,{field:'infoName',  title: '学院名'}
	      ,{fixed: 'right', title:'操作', width: 165, align:'center', toolbar: '#barDemo'}
	    ]]
 		 ,id: 'data_form'
	  });
  
  
	  //监听工具条
	  table.on('tool(main)', function(obj){
	    var data = obj.data;
	    if(obj.event === 'detail'){
	      layer.msg('ID：'+ data.id + ' 的查看操作');
	    } else if(obj.event === 'del'){
	      layer.confirm('真的删除行么', function(index){
	        obj.del();
	        layer.close(index);
	      });
	    } else if(obj.event === 'edit'){
	      layer.alert('编辑行：<br>'+ JSON.stringify(data))
	    }
	  });
  
  		
	  //头工具栏事件
	  table.on('toolbar(main)', function(obj){
	    var checkStatus = table.checkStatus(obj.config.id);
	    switch(obj.event){
	      case 'add':
	    	  layer.open({
	    		  title: '添加页面',
	    		  type: 2, 
	    		  area: ['50%', '90%'],
	    		  content: './Form_toAdd'
	    	  });
	      break;
	      case 'getCheckLength':
	        var data = checkStatus.data;
	        layer.msg('选中了：'+ data.length + ' 个');
	      break;
	      case 'isAll':
	        layer.msg(checkStatus.isAll ? '全选': '未全选');
	      break;
	    };
	  });
	  
  
  var $ = layui.$, active = {
		    reload: function(){
		      var searchId = $('#search_id');
		      table.reload("data_form",{
		    	  url:'<%=path %>/biz/Info_list'
		    	  ,where: {
		    		  infoId: searchId.val(),
		    		  level: 1
		    	  }
		          ,page: {
		            curr: 1 //重新从第 1 页开始
		          }
		      });
		      //执行重载
		    }
  
		  };
		  
		  $('.data-search .layui-btn').on('click', function(){
		    var type = $(this).data('type');
		    active[type] ? active[type].call(this) : '';
		  });

  
});
</script>



    <script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>

<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container">
    <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>

  </div>
</script>
</body>
</html>